#!/usr/bin/python
# coding=utf8
#
# Copyright (C) 2011 XNData contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


__author__ = "zhangchitc@gmail.com"


class AlbumProfile:
    owner_id = ""
    album_id = ""
    snapshot_url = ""
    description = ""
    total_photo = -1

    def __init__ (self, owner_id=None, album_id=None, snapshot_url=None,
                    description=None, total_photo=None):
        self.owner_id = owner_id
        self.album_id = album_id
        self.snapshot_url = snapshot_url
        self.description = description
        self.total_photo = total_photo

    def __repr__ (self):
        ret = ""
        ret += "owner_id = %s\n" % self.owner_id
        ret += "album_id = %s\n" % self.album_id
        ret += "snapshot_url = %s\n" % self.snapshot_url
        ret += "description = %s\n" % self.description
        ret += "total_photo = %s\n" % self.total_photo
        return ret

    def __str__ (self):
        return self.__repr__ ()



class AlbumList:
    
    owner_id = ""
    cur_page = -1
    album_list = []

    def __init__ (self, owner_id=None, cur_page=None):
        self.owner_id = owner_id
        self.cur_page = cur_page
        self.album_list = []

    def __repr__ (self):
        ret = ""
        ret += "owner_id = %s\n" % self.owner_id
        ret += "cur_page = %d\n" % self.cur_page
        for i, album_profile in zip(xrange(len(self.album_list)), self.album_list):
            ret += "                         ----- The [%dth] album -----\n" % i
            ret += str(album_profile)
        return ret

    def __str__ (self):
        return self.__repr__ ()

    def __len__ (self):
        return len (self.album_list)
    
    def __getitem__ (self, index):
        return self.album_list[index]

    def addAlbumProfile (self, album_profile):
        self.album_list.append (album_profile)



class PhotoProfile:
    
    owner_id = ""
    photo_id = ""
    snapshot_url = ""
    description = ""

    def __init__ (self, owner_id=None, photo_id=None, snapshot_url=None,
                    description=None):
        self.owner_id = owner_id
        self.photo_id = photo_id
        self.snapshot_url = snapshot_url
        self.description = description

    def __repr__ (self):
        ret = ""
        ret += "owner_id = %s\n" % self.owner_id
        ret += "photo_id = %s\n" % self.photo_id
        ret += "snapshot_url = %s\n" % self.snapshot_url
        ret += "description = %s\n" % self.description
        return ret

    def __str__ (self):
        return self.__repr__ ()


class PhotoList:

    owner_id = ""
    album_id = ""
    cur_page = -1
    photo_list = []

    name = ""
    site = ""
    description = ""

    def __init__ (self, owner_id=None, album_id=None, cur_page=None, 
                    name=None, site=None, description=None):
        self.owner_id = owner_id
        self.album_id = album_id
        self.cur_page = cur_page
        self.photo_list = []

        self.name = name
        self.site = site
        self.description = description

    def __repr__ (self):
        ret = ""
        ret += "owner_id = %s\n" % self.owner_id
        ret += "album_id = %s\n" % self.album_id
        ret += "cur_page = %d\n" % self.cur_page
        ret += "name = %s\n" % self.name
        ret += "site = %s\n" % self.site
        ret += "description = %s\n" % self.description
        for i, photo_profile in zip(xrange(len(self.photo_list)), self.photo_list):
            ret += "                         ----- The [%dth] photo -----\n" % i
            ret += str(photo_profile)
        return ret

    def __str__ (self):
        return self.__repr__ ()

    def __len__ (self):
        return len (self.photo_list)

    def __getitem__ (self, index):
        return self.photo_list[index]

    def addPhotoProfile (self, photo_profile):
        self.photo_list.append (photo_profile)

   
class PhotoDetail:
    
    owner_id = ""
    photo_id = ""
    large_url = ""
    description = ""

    def __init__ (self, owner_id = None, photo_id = None,
                    large_url = None, description = None):
        self.owner_id = owner_id
        self.photo_id = photo_id
        self.large_url = large_url
        self.description = description

    def __repr__ (self):
        ret = ""
        ret += "owner_id = %s\n" % self.owner_id
        ret += "photo_id = %s\n" % self.photo_id
        ret += "large_url = %s\n" % self.large_url
        ret += "description = %s\n" % self.description
        return ret

    def __str__ (self):
        return self.__repr__ ()



if __name__ == "__main__":
    
    #album_profile = AlbumProfile (
    #    owner_id = "242124580",
    #    album_id = "432244996", 
    #    snapshot_url = "http://fmn.xnpic.com/fmn050/20110711/1045/p_main_f5Pz_59f30002bb3d5c41.jpg",
    #    description = "神仙姐姐系列", 
    #    total_photo = 16)
    
    #print album_profile

    #album_list = AlbumList ("242124580", 0)
    #album_list.addAlbumProfile (album_profile)
    #album_list.addAlbumProfile (album_profile)
    #album_list.addAlbumProfile (album_profile)
    
    #print album_list

    pass
